﻿using System.Collections.Generic;

namespace NoteHelper.BaseControl
{
    public class Helper4Factory
    {
        private Dictionary<string, IControlHelper> _serializerMap = new Dictionary<string, IControlHelper>();
        private static Helper4Factory factory;

        private Helper4Factory()
        {
            _serializerMap.Add("TextBox", new Helper4TextBox());
            _serializerMap.Add("Label", new Helper4Label());
            _serializerMap.Add("CheckBox", new Helper4CheckBox());
            _serializerMap.Add("ComboBox", new Helper4ComboBox());
            _serializerMap.Add("RichTextBox", new Helper4RichTextBox());
            _serializerMap.Add("DateTimePicker", new Helper4DateTimePicker());
            _serializerMap.Add("NumericUpDown", new Helper4NumericUpDown());
            _serializerMap.Add("CyDateBox", new Helper4CyDateBox());
        }

        public static Helper4Factory Instance()
        {
            if (factory == null)
            {
                factory = new Helper4Factory();
            }

            return factory;
        }

        public IControlHelper GetControlHelper(string name)
        {
            return _serializerMap[name];
        }
    }
}
